package com.blackhorse.dao;

import com.blackhorse.domain.Account;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 账户dao接口
 */
@Repository
public interface AccountDao {
    //查询所有账户
    @Select("select * from account")
    public List<Account> findAll();

    //根据id查询账户
    @Select("select * from account where id = #{value}")
    public Account findById(int id);

    //保存账户
    @Insert("insert into account(name, money) values(#{name}, #{money})")
    public void saveAccount(Account account);

    //更新账户
    @Insert("update account set name = #{name}, money = #{money} where id = #{id}")
    public void updateAccount(Account account);
}
